package com.ark.frigate.zookeeper.event;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author ZengWeiLong
 * @Description Copy Right Beyonca
 * @Date 2022/7/13 20:25
 * @Version 1.0
 */
@Slf4j
@Component
public class MyApplicationListener {

    @Async
    @EventListener(condition = "#event.isAsync")
    public void listener(MyEvent event) {
        log.info("===========+注解异步=============" + event.getSource());
    }

    @EventListener(condition = "#event.isAsync == false ")
    public void onApplicationEvent(MyEvent event) {
        log.info("============注解同步=============" + event.getSource());
    }
}
